<?php
// +----------------------------------------------------------------------
// | Iecms [ Make the most exquisite CMS ]
// +----------------------------------------------------------------------
// | Copyright (c) 2009~2019 http://www.iemoo.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: iemoo <i@iemoo.com>
// +----------------------------------------------------------------------
// | DateTime: 2019/11/19 11:08
// +----------------------------------------------------------------------
namespace app\admin\controller;

use app\common\model\SystemItem as SystemItemModel;
use app\common\model\SystemGroup as SystemGroupModel;

use app\admin\validate\SystemItem as SystemItemValidate;
use app\admin\validate\SystemGroup as SystemGroupValidate;

use think\exception\ValidateException;


use think\facade\Request;
use think\facade\View;
use think\facade\Config;

/**
 * 网站配置管理
 */
class Website extends Base
{
 
    /**
     * 网站配置管理
     * @return mixed
     */
    public function index()
    {

		if (Request::isPost()) {

            $data	= Request::only(['value']);

	
			foreach($data['value'] as $key => $val){
				SystemItemModel::update(['value' => $val], ['id' => $key]);
			}

			$this->success('保存成功',url('admin/Website/index'));

        }



		$group = SystemGroupModel::where('id',1)->select();
		foreach($group as $key => $val){
			$group[$key]->item = $val->items()->select();
		}
		$group = system_item($group);
		View::assign('group',$group);


		return View::fetch('index');
    }

}